from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from items.beverage import beverage
from core.support import set_cutscene

class bar(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        # add inventory items
        self.add_item(beverage())
            
        # build list of actions
        self.add_action(tables)
        self.add_action(dancefloor)
        self.add_action(buydrink)
        self.add_action(buybeckydrink)
        
    
    # return description of room.
    def get_description(self):
        return "You are parched and could use a refreshing libation. There are a couple of ladies in the queue who could probably use a drink too...."
    
    # return image of room
    def get_image(self):
        return 'bar.jpg'


class BarHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return bar

# define actions for this room

class dancefloor(Action):
    def __init__(self):
        Action.__init__(self, "dancefloor")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Hit the Dance Floor"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'dancefloor'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class tables(Action):
    def __init__(self):
        Action.__init__(self, "tables")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Go to Your Table"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'tables'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"
    
class buybeckydrink(Action):
    def __init__(self):
        Action.__init__(self, "buybeckydrink")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Buy Cousin Becky a Drink"
    
    # return id of room to enter when action is complete
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'loserroom'
    
    # set cutscene for when arrive in outside
    def do_action(self,game,room,request):
        set_cutscene("She's 14 for god's sakes!!")
        return
    
    def get_method(self):
        return "get"
    
class buydrink(Action):
    def __init__(self):
        Action.__init__(self, "buydrink")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Buy the Hottie a Drink"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'bar'
    
    def do_action(self,game,room,request):
        set_cutscene("She accepts. Nice move. +1 interaction points, bro!")
        game.social+=1
        self.usable = False
        return
    
    def get_method(self):
        return "get"